// modules/goodsModule/pages/goods/detail/detail.ts
import { getGoodsDetailAsyn } from '../../../api/asyn'
Page({

  /**
   * 页面的初始数据
   */
  data: {
    id: "",
    goodsDetail: {},
    goodsUrls: [],
    goodsData: [],
    requestData: {
      page: 1,
      size: 4
    },
    show: false
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options: any) {
    this.getGoodsDetail(options.goodsId)
  },
  async getGoodsDetail(id: string) {
    const res = await getGoodsDetailAsyn(id, this.data.requestData)
    this.setData({
      goodsDetail: res[0].data,
      goodsUrls: res[1].data,
      goodsData: res[2].data.records
    })
    console.log(this.data.goodsData)
  },
  onAddShopCart() {
    this.setData({
      show: true
    })
    console.log(this.data.show)
  }
})